package utils;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.URLConnection;


public class HttpUtils {

	public static String getHtmlUrlContent(String url, Object... parametros) throws Exception {
		
		String str = parametros != null ? String.format(url,parametros) : url;

		URL website = new URL(str);
		URLConnection connection = website.openConnection();
		BufferedReader in = new BufferedReader(
				new InputStreamReader(
						connection.getInputStream()));

		StringBuilder response = new StringBuilder();
		String inputLine;

		while ((inputLine = in.readLine()) != null) 
			response.append(inputLine);

		in.close();

		return response.toString();
	}
}
